<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="/vue.js"></script>
</head>
<body>
    <div id="container">
        <com1 @input='fn($event)' :username='username'></com1>
    </div>
    <template id="com1">
        <div>
            <input type="text" :value='username' @input='fn($event)'>
        </div>
    </template>
</body>
<script>
    Vue.component('com1',{
        template:'#com1',
        props:['username'],
        data(){
            return {

            }
        },
        methods:{
            fn(e){
                let val=e.target.value;
                this.$emit('input',val);
            }
        }
    })
    Vue.component('com2',{
        template:'#com2',
        data(){
            return {}
        },
    })
    Vue.component('com3',{
        template:'#com3',
        data(){
            return {}
        },
    })
    var vm=new Vue({
        el:'#container',
        data(){
            return {
              arr:[1,2,3,4,5],
              com:'com1',
              username:'',
            }
        },
        created(){
        },
        computed:{
        },
        watch:{
           
        },
        methods:{
          say(data){
              console.log(data);
          },
          fn(data){
              this.username=data;
          }
        }
    });
</script>
</html>